import InteractiveBase from "../../../LevelCommon/InteractiveBase";
import MoveCubeLock from "./MoveCubeLock";
import Sound from "../../../../constant/SoundNameConstant";
import { utils } from "../../../../utils/CommonUtil";
import EnumData from "../../../../Enum/EnumData";


export default class MoveCubeDir extends InteractiveBase {
    /** 方向*/
    public curDir: EnumData.MoveCubeDirEnum;
    private moveCubeLock: MoveCubeLock;
    private curMaterial:Laya.BlinnPhongMaterial;
    private oringinColor:Laya.Vector4;
    //  Tween colorTween;
    private mowner: Laya.MeshSprite3D;
    onStart() {
        this.mowner = this.owner as Laya.MeshSprite3D;
        this.moveCubeLock = this.mowner.parent.getComponent(MoveCubeLock);
        this.curMaterial = this.mowner.meshRenderer.material as Laya.BlinnPhongMaterial;
        this.oringinColor = this.curMaterial.albedoColor;
    }
    protected InteractiveLogic(): boolean {
        window.gameFacade.SoundMng.playSound(Sound.soundClipArr.BUTTON);
        
        utils.CommonUtils.DOColorTween(this.curMaterial,new Laya.Vector4(1,0,0,1),100,new Laya.Handler(this,()=>{
            utils.CommonUtils.DOColorTween(this.curMaterial,this.oringinColor,100,null);
        }))
        this.moveCubeLock.InputDir(this.curDir);
        return false;
    }
}